<?php

namespace Home\Controller;
use Think\Controller;

class InformationController extends CommonController {

    public function index(){
        $department_id = I('id');
        $this->res = M('department')->find($department_id);
		$this->display();
    }
    public function handle(){
    	$url = uploadImage();
        $db=M('admin');
        $department_id = I('department_id');
        $user=$db->find($department_id);
        $dat=array(
            'image_url'=>$url
            );
        $data=array(
            'id'=>$user['department_id'],
            'function'=>$_POST['function'],
            'content'=>$_POST['content']
            );
        if($url!=-1)
            $data = array_merge($data, $dat);
        if(M('department')->data($data)->save()){
    		$this->success('修改成功');
    	}
    }
}